#include <stdio.h>
#include <stdlib.h> 
struct Node{
    int data;
    struct Node *next;
};
int main(){
    int n;
    scanf("%d",&n);
    struct Node *L,*M;
    L = (struct Node *)malloc(sizeof(struct Node)); 
    L->next = NULL;
    int m;
    while(scanf("%d",&m)&&m>=0){
    M=(struct Node *)malloc(sizeof(struct Node));
        M->data=m;
        M->next=L->next;
        L->next=M;
    }
    for(int i=0;i<n;i++){
        L=L->next;
    }
    if(L){
        printf("%d\n",L->data);
    }else{
          printf("NULL\n");
    }
     return 0;
}